<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <s:i18n name="globalMessages"></s:i18n>
    <title>上传个人图像</title>
    
	<meta http-equiv="pragma" content="no-cache">
    <script type='text/javascript' src='dwr/interface/userdwr.js'></script>
     <script type='text/javascript' src='dwr/interface/areadwr.js'></script>
    <script type="text/javascript" src="<s:url value="/js/jquery-1.4.2.min.js"/>"></script>
    <script type='text/javascript' src='js/jquery.validate.min.js'></script>
    <script type='text/javascript' src='js/common.js'></script>
<link href="images/css.css" rel="stylesheet" type="text/css" />
	
<style type="text/css">
<!--
.STYLE1 {color: #828282}
-->
</style>

<script type="text/javascript">
			//初始化验证
			$().ready(function() {
				$("#addForm").validate({
					rules : {
						pic: {
							required:true,
							accept:true							
						}
					},
					messages : {
						pic : {
							required: "请选择要上传的图片",
							accept: "请选择正确的文件格式"
						}
					}
				});
			});
</script>

<script type="text/javascript">
	function uploadSubmit(){
		var fname = $.trim($("#pic").val());
		alert("文件名==="+fname);
//		var subName = fname.substring(fname.lastIndexOf("\")+1, fname.lastIndexOf(".")+4);
//		$("#picFileName").val(subName);
//		alert("文件名==="+subName);
		//表单提交
	    document.addForm.submit();
	}

</script>

  </head>
  
<body>
    <form name="addForm" id="addForm" action="companyLogoUpload!uploadEnterpriseLogo.action" enctype="multipart/form-data" method="post">
		<table width="584" border="0" align="center" cellpadding="0" cellspacing="0" class="gxzp">
			  <tr>
			    <td width="46" height="25" align="left" valign="middle"  class="gxzp1">&nbsp;&nbsp;</td>
			    <td width="538" align="left" valign="middle"  class="gxzp1"><strong>更换照片:</strong></td>
			  </tr>
			  <tr>
			    <td height="98" colspan="2" align="left">
			    <s:hidden id="picFileName" name="picFileName" value="" ></s:hidden>
		<%--   <form name="tjgxzp" id="tjgxzp" action="jbzl.html" method="post"></form> --%>
			      <table width="490" height="68" border="0" align="center" cellpadding="0" cellspacing="0">
			        <tr>
			          <td height="31"><input type="file" name="pic" id="pic" size="50" accept="image/gif,jpg" /></td>
			        </tr>
			        <tr>
			          <td height="16"><span class="STYLE1">文件格式JPG、GIF，建议尺寸240PX*200px</span></td>
			        </tr>
			        <tr>
			          <td height="21">
			            <input type="button" onclick="javascript:uploadSubmit();" name="" value="保存图片 " class="button" />
			            <input type="button"  value=" 取  消 " onclick="window.close();" />
								<%-- 展示错误的字幕		--%>	
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<span style="color: red;"><s:actionerror/></span>		
			          </td>
			        </tr>
			      </table>
			           
			     </td>
			  </tr>
		</table>    	
    	
    </form>
</body>
</html>
